<?php
$this->registerCssFile('@static/css/newlist.css');
use pc\models\Search;

function markKeyword($queryWords,$string,$queryString){
    foreach ($queryWords as $word){
        $string = str_replace($word['name'],'<em>'.$word['name'].'</em>',$string);
    }
    $string = str_ireplace($queryString,'<em>'.$queryString.'</em>',$string);
    return $string;
}


if($searchType == Search::TYPE_ALL){
    $this->title = "【{$queryString}】搜索美女_查找美女-果图网";
    $this->registerMetaTag([
        'name'=>'description',
        'content'=>"果图网(guotuw.com )为你搜索查找到{$queryString}相关美女信息，搜索查找美女写真图片照片、个人资料、新闻资讯就上果图网！",
    ]);
}
if($searchType == Search::TYPE_STAR){
    $this->title = "【{$queryString}】搜索美女个人资料_查找美女个人资料-果图网";
    $this->registerMetaTag([
        'name'=>'description',
        'content'=>"果图网(guotuw.com)为你搜索查找到{$queryString}相关美女个人资料信息，搜索查找美女写真图片照片个人资料就上果图网！",
    ]);
}
if($searchType == Search::TYPE_PORTRAY){
    $this->title = "【{$queryString}】搜索美女写真_查找美女写真-果图网";
    $this->registerMetaTag([
        'name'=>'description',
        'content'=>"果图网(guotuw.com)为你搜索查找到{$queryString}相关美女写真信息，搜索查找美女写真图片照片写真就上果图网！",
    ]);
}
if($searchType == Search::TYPE_NEWS){
    $this->title = "【{$queryString}】搜索美女新闻资讯_查找美女新闻资讯-果图网";
    $this->registerMetaTag([
        'name'=>'description',
        'content'=>"果图网(guotuw.com )为你搜索查找到{$queryString}相关美女新闻资讯信息，搜索查找美女写真图片照片新闻资讯就上果图网！",
    ]);
}

if($page > 1){
    $this->title .= "-第{$page}页";
}

?>
<div class="main wrapper">
    <div class="main_l fl">
        <div class="place_nav">
            <a href="<?=Yii::$app->request->getHostInfo();?>" title="高清美女图片大全_美女明星排行榜_找美女-果图网" class="icon_home"><em></em></a>
            <a href="<?=Yii::$app->request->getHostInfo();?>" title="高清美女图片大全_美女明星排行榜_找美女-果图网">果图网</a>>
            <?php if($searchType == Search::TYPE_ALL) echo "果图网站内搜索:【{$queryString}】";?>
            <?php if($searchType == Search::TYPE_STAR) echo "果图网站内搜索:【{$queryString}】美女";?>
            <?php if($searchType == Search::TYPE_PORTRAY) echo "果图网站内搜索:【{$queryString}】美女写真";?>
            <?php if($searchType == Search::TYPE_NEWS) echo "果图网站内搜索:【{$queryString}】美女新闻";?>
        </div>

        <div class="tab_nav">
            <ul>
                <li <?php if($searchType == Search::TYPE_ALL) echo  'class="cur"';?> ><a href="/search/?keyword=<?=$queryString?>">综合</a></li>
                <li <?php if($searchType == Search::TYPE_STAR) echo  'class="cur"';?> ><a href="/search/meinv/?keyword=<?=$queryString?>">美女</a></li>
                <li <?php if($searchType == Search::TYPE_PORTRAY) echo  'class="cur"';?> ><a href="/search/xiezhen/?keyword=<?=$queryString?>">写真</a></li>
                <li <?php if($searchType == Search::TYPE_NEWS) echo  'class="cur"';?>><a href="/search/news/?keyword=<?=$queryString?>">新闻</a></li>
            </ul>
        </div>

        <div class="new_list">
            <ul>
                <?php if($recommend):?>
                <li style="height: 50px;">
                    <img src="/static/images/nodata.png" style="width: 100%;">
                </li>
                <div class="clear"></div>
                <?php endif;?>

                <?php foreach ($data as $vo):?>
                    <?php $type = $searchType > 0 ? $searchType : intval($vo['searchType']); ?>
                    <?php if($type == Search::TYPE_STAR):?>
                        <li>
                            <a title="<?=$vo['name']?>(<?=$vo['nick_name']?>)" href="/meinv/<?=$vo['id']?>.html" target="_blank">
                                <img title="<?=$vo['name']?>(<?=$vo['nick_name']?>)" alt="<?=$vo['name']?>(<?=$vo['nick_name']?>)" src="<?=$vo['header']?>">
                                <strong><?php echo markKeyword($queryWords,$vo['name'],$queryString);?>(<?php echo markKeyword($queryWords,$vo['nick_name'],$queryString);?>)</strong>
                                <p><?php echo markKeyword($queryWords,$vo['desc'],$queryString);?></p>
                            </a>
                            <?php if(!empty($queryWords)): ?>
                            <span>
                                <em>标签</em>
                                <?php
                                    foreach ($queryWords as $tag){
                                        $url = intval($tag['category']) == 2 ? 'xiezhen' : 'meinv';
                                        $type = intval($tag['category']) == 2 ? '美女写真' : '美女';
                                        echo '<a target="_blank" style="color:#f69;"  title="',$tag['name'],$type,'" href="/',$url,'/',$tag['alias'],'/" >',$tag["name"],'</a>  ';
                                    }
                                ?>
                            </span>
                            <?php endif;?>
                        </li>
                    <?php elseif ($type == Search::TYPE_PORTRAY):?>
                        <li>
                            <a title="<?=$vo['title']?>" href="/xiezhen/<?=$vo['id']?>.html" target="_blank">
                                <img title="<?=$vo['title']?>" alt="<?=$vo['title']?>)" src="<?=$vo['x_img']?>">
                                <strong><?php echo markKeyword($queryWords,$vo['title'],$queryString);?></strong>
                                <p><?php echo markKeyword($queryWords,$vo['desc'],$queryString);?></p>
                            </a>
                            <?php if(!empty($vo['tags'])): ?>
                                    <span>
                                    <em>标签</em>
                                        <?php
                                            $alias =array_column($queryWords,'alias');
                                            foreach ($vo['tags'] as $tag){
                                                $class = in_array($tag['alias'],$alias) ? 'style="color:#f69;" ' : '';
                                                $url = intval($tag['category']) == 2 ? 'xiezhen' : 'meinv';
                                                $type = intval($tag['category']) == 2 ? '美女写真' : '美女';
                                                echo '<a target="_blank" '.$class.' title="',$tag['name'],$type,'" href="/'.$url.'/',$tag['alias'],'/" >',$tag["name"],'</a>  ';
                                            }
                                        ?>
                                </span>
                            <?php endif;?>
                        </li>
                    <?php elseif ($type == Search::TYPE_NEWS):?>
                        <li>
                            <a title="<?=$vo['title']?>" href="/news/<?=$vo['id']?>.html" target="_blank">
                                <img title="<?=$vo['title']?>" alt="<?=$vo['title']?>)" src="<?=$vo['image']?>">
                                <strong><?php echo markKeyword($queryWords,$vo['title'],$queryString);?></strong>
                                <p><?php echo markKeyword($queryWords,$vo['desc'],$queryString);?></p>
                            </a>
                            <?php if(!empty($queryWords)): ?>
                            <span>
                                <em>标签</em>
                                <?php
                                        foreach ($queryWords as $tag) {
                                            $url = intval($tag['category']) == 2 ? 'xiezhen' : 'meinv';
                                            $type = intval($tag['category']) == 2 ? '美女写真' : '美女';
                                            echo '<a target="_blank" style="color:#f69;"  title="', $tag['name'], $type, '" href="/', $url, '/', $tag['alias'], '/" >', $tag["name"], '</a>  ';
                                        }
                                ?>
                            </span>
                            <?php endif;?>
                        </li>
                    <?php endif;?>
                <?php endforeach;?>
        </div>

        <!--分页-->
        <div class="page"> <?=$pageString;?></div>
    </div>


    <div class="main_r fr ">
        <?php echo $this->render('/meinv/hotStar',['stars' => $stars]);?>
        <?php echo  $this->render('/xinwen/recommendArticle'); ?>
        <?php echo  $this->render('/layouts/hotTags');?>
    </div>

    <div class="clear"></div>
</div>

